import time

import pymysql
import requests


def pay():
    body = {
        'amount': '20',
        'driver_id': '38004',
        'shop_id': 'lihujun008',
        'platform': 'wx',
        'access_token': 'eyJleHAiOjE1MzAyNzIwMzEsImtpZCI6N30.eyJ1aWQiOiIyMDAwMTQ4MjExIn0.KXLPq9GfqN_Y4q7nHec5svS27LIk4bVhDkuoXd-22F8'
    }
    CreateFarePaySign = requests.post('http://wangwang.hhbgrd.com/Pay/CreateFarePaySign', body)
    print(CreateFarePaySign.text)


def exec_sql():
    conf = {
        'host': '192.168.16.18',
        'port': 6006,
        'user': 'dev',
        'password': 'jmdevcd',
        'db': 'growth_unmanned_shelves',
        'charset': 'utf8'
    }
    sql2 = "update `growth_unmanned_shelves`.`meidian_order` set uid ='2000148210' where uid ='2000148211';"

    conn = pymysql.connect(**conf)
    print('mysql连接成功')
    cur = conn.cursor()
    cur.execute(sql2)
    conn.commit()
    # 关闭游标
    cur.close()

    # 关闭连接
    conn.close()


def exec_sql1(no=None):
    conf = {
        'host': '192.168.16.18',
        'port': 6006,
        'user': 'dev',
        'password': 'jmdevcd',
        'db': 'growth_unmanned_shelves',
        'charset': 'utf8'
    }
    sql2 = "INSERT INTO `growth_unmanned_shelves`.`meidian_driver_recruitment_profit`( `uid`, `from_uid`, `amount`, `order_id`, `activity_id`, `create_time`) VALUES (34002, 38004, 2.00, 86142, 0, 1530102223);"
    #sql3 = "INSERT INTO meidian_driver_recruitment_relation(`driver_id`, `driver_uid`, `recruitmenter_uid`, `recruitment_out_id`, `recruitment_channel`, `activity_id`, `status`, `op_user`, `op_text`, `create_time`, `active_time`) VALUES (%s, 38008, 34002, 1, 1, 1, 1, 'system', '测试', 1530176265, 0);"%no
    conn = pymysql.connect(**conf)
    print('mysql连接成功')
    cur = conn.cursor()
    cur.execute(sql2)
    conn.commit()
    # 关闭游标
    cur.close()

    # 关闭连接
    conn.close()



if __name__ == '__main__':
    #[exec_sql1(n) for n in range(500,560)]
    pay()
    exec_sql()
